# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements.  See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License.  You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.



# 整个broker集群名称,或者说是RocketMq集群的名称
brokerClusterName=BrokerCluster

# 指定master-slave集群的名称,一个rocketMq集群可以包含多个master-slave集群
brokerName={{ broker_name }}

# 集群中0表示Master,>0表示Slave
brokerId={{ broker_id }}

# 删除消息存储过期文件的时间,默认凌晨四点
deleteWhen=04

# 指定未发生更新的消息存储文件的保留时间为默认48消失,过期将被删除
fileReservedTime=48

# broker的角色(主节点)
brokerRole={{ broker_role }}

# 刷盘方式
# - ASYNC_FLUSH 异步刷盘
# - SYNC_FLUSH 同步刷盘
flushDiskType=ASYNC_FLUSH

# nameServer地址,集群用分号分割,格式为: namesrvAddr=172.16.10.90:9876;172.16.10.91:9876

{% set urls = [] %}  
{%- for host in groups[rocketmq.group] %}  
{%- set host_vars = hostvars[host] %}  
{%- if host_vars['broker_role'] == 'SYNC_MASTER' %} 
{%- set ip = host_vars['ansible_ssh_host'] %}
{%- set url = ip ~ ':' ~ rocketmq.namesrv_port %}  
{%- set _ = urls.append(url) %}  
{%- endif %}  
{%- endfor %}
namesrvAddr={{ ';'.join(urls) }}

# 指定broker的IP,需要根据每台机器进行修改,官方介绍可为空,系统默认自动识别,但多网卡时IP地址读取可能出错。
brokerIP1={{ ansible_ssh_host }}

# broker对外服务的监听端口
listenPort={{ rocketmq.port }}


########################################################################### 新加配置 ###########################################################################


# 存储路径
storePathRootDir={{ rocketmq.data_dir }}/store

# commitLog 存储路径
storePathCommitLog={{ rocketmq.data_dir }}/store/commitlog

# 消费队列存储路径存储路径
storePathConsumeQueue={{ rocketmq.data_dir }}/store/consumequeue

# 消息索引存储路径
storePathIndex={{ rocketmq.data_dir }}/store/index

# checkpoint 文件存储路径,这个是个文件,不是文件夹
storeCheckpoint={{ rocketmq.data_dir }}/store/checkpoint

# abort 文件存储路径,这个是个文件,不是文件夹
abortFile={{ rocketmq.data_dir }}/store/abort

# 是否允许Broker自动创建Topic,建议线下开启,线上关闭
autoCreateTopicEnable=false

# 是否允许Broker自动创建订阅组,建议线下开启,线上关闭
autoCreateSubscriptionGroup=false

# 在发送消息时,自动创建服务器不存在的topic,默认创建的队列数
defaultTopicQueueNums=4

# ConsumeQueue每个文件默认存30W条,根据业务情况调整
mapedFileSizeConsumeQueue=300000

# commitLog每个文件的大小默认1G
mapedFileSizeCommitLog=1073741824

#检测物理文件磁盘空间
diskMaxUsedSpaceRatio=80

#限制消息内容大小,默认为4M 
maxMessageSize=65536

#发送消息线程池数量
sendMessageThreadPoolNums=128

#拉消息线程池数量
pullMessageThreadPoolNums=128

#发送消息是否使用可重入锁
useReentrantLockWhenPutMessage=true

# 清理过期请求时,如果请求线程的创建时间到当前系统时间间隔大于 waitTimeMillsInSendQueue(默认 200ms,可以配置）就会清理这个请求, 然后给 Producer 返回一个系统繁忙的状态码
waitTimeMillsInSendQueue=300

# 开启权限控制
{% if rocketmq.acl.enable %}
aclEnable=true
{% endif %}
